<?php
class newsTypeController extends Controller
{
    function showIndex()
    {
        $pagination_sql = "select * from news_type order by createDate desc";
        $pagination_count_sql = "select count(1) as count from news_type order by createDate desc";
        $this->putIntoPage("pagination", $this->modules->NewsType->pagination($pagination_sql, $pagination_count_sql));
        return $this->render("NewsType");
    }

    function save()
    {
        $this->putIntoPage("isSuccess", isset($this->_post['newsTypeId']) && $this->_post['newsTypeId'] > 0
                                              ? $this->modules->NewsType->update($this->_post)
                                              : $this->modules->NewsType->insert($this->_post));
        $this->showIndex();
    }

    function del()
    {
        $this->modules->NewsType->delete($this->_get['id']);
        $this->showIndex();
    }
}

?>